clc;
clear;

pde = PDE_struct_2d(1);
vector_N = [16 32 64];
basis_type = "P1";

error_L2 = zeros(size(vector_N,2),1);
error_H1 = zeros(size(vector_N,2),1);

for i = 1:size(vector_N,2)
    Nx = vector_N(i);
    Ny = Nx;
    mesh = Mesh_struct_2d(pde, Nx, Ny, basis_type);
    U = poisson_solver_2d(mesh, pde);
    error_L2(i,1) = process_error_2d(mesh, pde, U, "L2");
    % error_H1(i,1) = process_error_2d(mesh, pde, U, "H1");
    fprintf("完成%d/%d次\n", i, size(vector_N,2));
end

process_convergence_2d(error_L2, vector_N);
% process_convergence_2d(error_H1, vector_N);

